package nc.ui.pn.old;

import nc.ui.bill.pub.SingleBodyEventHandler;
import nc.ui.pub.ButtonObject;
import nc.ui.pub.ClientEnvironment;
import nc.ui.pub.beans.UIDialog;
import nc.ui.pub.bill.BillModel;
import nc.ui.trade.base.IBillOperate;
import nc.ui.trade.bill.ICardController;
import nc.ui.trade.card.BillCardUI;
import nc.vo.jx.pub.JxPubConst;

public class InvOldEH extends SingleBodyEventHandler {

	ClientEnvironment cl = null;
	String[] infors = null;
	private ClientUIQueryDlg m_queryDlg = null;
	@Override
	protected UIDialog getQueryUI() throws Exception {
		if(null == m_queryDlg){
			m_queryDlg = new ClientUIQueryDlg(getBillUI(),null,_getCorp().getPrimaryKey(),JxPubConst.NODECODE_INVNUM,_getOperator(),null,null);
		}
		return m_queryDlg;
	}
	public InvOldEH(BillCardUI billUI, ICardController control) {
		super(billUI, control);
	}

	@Override
	public void onBoAdd(ButtonObject bo) throws Exception {
		getBillUI().setBillOperate(IBillOperate.OP_EDIT);
		onBoLineAdd();
		int selectRow = getBillCardPanelWrapper().getBillCardPanel().getBillTable().getSelectedRow();
		BillModel model = getBillCardPanelWrapper().getBillCardPanel().getBodyPanel().getTableModel();
		model.setRowEditState(true);
		model.setEditRow(selectRow);
		setDefBodyData(selectRow);
	}
	
	private void setDefBodyData(int row) {
		cl = ((InvOldClientUI)getBillUI()).cl;
		infors = ((InvOldClientUI)getBillUI()).infors;
		setBodyValue(cl.getCorporation().getPk_corp(),row,"pk_corp");
	}
	private void setBodyValue(String value,int row,String name){
		getBillCardPanelWrapper().getBillCardPanel().setBodyValueAt(value,row,name);
	}
}
